How to find the index of a character in java